//
//  Paddle.m
//  BeatPong
//
//  Created by Gabriel Lumbi on 12-08-19.
//
//

#import "Paddle.h"
#import "cocos2d.h"

@implementation Paddle

@synthesize width, height, color;

#pragma mark -
#pragma mark Life Cycle

-(id) init
{
    if(self = [super init]){
        width = 100;
        height = 30;
        color = ccc4f(1.f, 1.f, 1.f, 1.f);
    }
    return self;
}

-(void) dealloc
{
    [super dealloc];
}

#pragma mark -
#pragma mark Draw

-(void) draw
{
    [super draw];
    
    ccDrawColor4F(color.r, color.g, color.b, color.a);
    float halfWidth = width/2;
    float halfHeight = height/2;
    ccDrawRect([self convertToNodeSpace:CGPointMake(self.position.x - halfWidth, self.position.y - halfHeight)],
               [self convertToNodeSpace:CGPointMake(self.position.x + halfWidth, self.position.y + halfHeight)]);
}

#pragma mark -

@end
